<%--
  - Author		:	Jaewon Choi
  - Date			:	2013.10.15
  - Description	:	
  --%>
<%@ page language="java" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/pages/includes/taglibs.jspf" %>
<%@ include file="/WEB-INF/pages/includes/variables.jspf" %>
<%@ include file="/WEB-INF/pages/includes/doctype.jspf" %>
<html>
	<head>
<%@ include file="/WEB-INF/pages/includes/metatags.jspf" %>
		<title><fmt:message key="pages.title" /></title>
		<link rel="stylesheet" type="text/css" href="<c:url value="${dirStyles}/common.css" />" />
		<link rel="stylesheet" type="text/css" href="<c:url value="${dirScripts}/jqueryUi/css/ui-lightness/jquery-ui-1.8.21.custom.css" />" />

		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-1.7.2.min.js" />"></script>
		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-ui-1.8.21.custom.min.js" />"></script>
		<script type="text/javascript" src="<c:url value="${dirScripts}/common.js" />"></script>
		<script type="text/javascript">
			$(function() {
				$( ".date" ).datepicker({
					showOn: "both",
					buttonImage: "<c:url value="${dirImages}/calendar.png" />",
					buttonImageOnly: true,
					dateFormat: "yy-mm-dd",
					changeMonth: true,
					changeYear: true
				});
			});
		</script>
	</head>
	<body>
		<div class="bodyWrap">
<%@ include file="/WEB-INF/pages/includes/header.jsp" %>
<%@ include file="/WEB-INF/pages/includes/left.jsp" %>
			<div class="contWrap">
				<div class="menuTitle">앱시작횟수</div>
				<div class="searchWrap">
					<form id="searchFrm" name="searchFrm" method="post">
						<ul  class="lineBlock">							
							<li>
								<font>검색조건</font>
								OS :
								<select name="osGubun" onchange="javascript:$('.osGubun').attr('disabled', 'disabled').hide();$('.'+this.value).removeAttr('disabled').show();">
									<option value="all" <c:if test="${param.osGubun eq 'all' || empty param.osGubun}"> selected="selected" </c:if>>All</option>
									<option value="ios" <c:if test="${param.osGubun eq 'ios'}"> selected="selected" </c:if>>iOS</option>
									<option value="android" <c:if test="${param.osGubun eq 'android'}"> selected="selected" </c:if>>Android</option>
									<option value="etc" <c:if test="${param.osGubun eq 'etc'}"> selected="selected" </c:if>>기타</option>
								</select>
								
							    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;기종 :
								<select class="osGubun all" name="model" <c:if test="${param.osGubun ne 'all' && not empty param.osGubun}"> disabled="disabled" style="display:none;" </c:if>>
									<option value="all" <c:if test="${param.model eq 'all'}"> selected="selected" </c:if>>All</option>
								</select>
								
								<select class="osGubun ios" name="model" <c:if test="${param.osGubun ne 'ios' || empty param.osGubun}"> disabled="disabled" style="display:none;" </c:if>>
									<option value="all" <c:if test="${param.model eq 'all'}"> selected="selected" </c:if>>All</option>
									<c:forEach items="${iosModelList}" var="iosModel">
										<option value="${iosModel.model}" <c:if test="${param.model eq iosModel.model}"> selected="selected" </c:if>>${iosModel.model}</option>
									</c:forEach>
								</select>
								
								<select class="osGubun android" name="model" <c:if test="${param.osGubun ne 'android' || empty param.osGubun}"> disabled="disabled" style="display:none;" </c:if>>
									<option value="all" <c:if test="${param.model eq 'all'}"> selected="selected" </c:if>>All</option>
									<c:forEach items="${androidModelList}" var="androidModel">
										<option value="${androidModel.model}" <c:if test="${param.model eq androidModel.model}"> selected="selected" </c:if>>${androidModel.model}</option>
									</c:forEach>
								</select>
								
								<select class="osGubun etc" name="model" <c:if test="${param.osGubun ne 'etc' || empty param.osGubun}"> disabled="disabled" style="display:none;" </c:if>>
									<option value="all" <c:if test="${param.model eq 'all'}"> selected="selected" </c:if>>All</option>
									<option value="etc" <c:if test="${param.model eq 'etc'}"> selected="selected" </c:if>>기타</option>
								</select>
								<!-- 
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;접속수단 : 
								<select class="conn" name="conn">
									<option value="all" <c:if test="${param.grp eq 'device'}"> selected="selected" </c:if>>All</option>
									<option value="comm" <c:if test="${param.grp eq 'device'}"> selected="selected" </c:if>>3G/LTE</option>
									<option value="wifi" <c:if test="${param.grp eq 'device'}"> selected="selected" </c:if>>Wifi</option>
								</select>
								 -->
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<input type="radio" name="type" class="type" value="pv" <c:if test="${param.type eq 'pv' || empty param.type}"> checked </c:if>>PV
								<input type="radio" name="type" class="type" value="uv" <c:if test="${param.type eq 'uv'}"> checked </c:if>>UV
							</li>
							<li>
								<font>조회기간</font>
								<label>
									<input type="radio" name="dateType" class="dateType" value="0" onclick="javascript:$('.date').attr('disabled', 'true');" <c:if test="${param.dateType eq 0 || empty param.dateType}"> checked="checked" </c:if>>전체
								</label>
								<label>
									<input type="radio" name="dateType" class="dateType" value="1" onclick="javascript:$('.date').removeAttr('disabled');" <c:if test="${param.dateType eq 1}"> checked="checked" </c:if>>
									<input type="text" class="date" name="startDate" readonly="readonly" value="${param.startDate}" /> ~ <input type="text" class="date" name="endDate" readonly="readonly" value="${param.endDate}" />
								</label>
							</li>
						</ul>
						<c:if test="${param.dateType eq 0 || empty param.dateType}">
						<script type="text/javascript">
						javascript:$('.date').attr('disabled', 'true');
						</script>
						</c:if>
						<center><input type="submit" class="btn" value="조회" /></center>
					</form>
				</div>
				<table class="listTbl tbl">
					<colgroup>
						<col width="88px;" />
						<col width="140" />
						<col width="440" />
						<col width="140" />
					</colgroup>
					<thead>
						<tr>
							<th style="text-align: center;">번호</th>
							<th style="text-align: center;">OS</th>
							<th style="text-align: center;">기종</th>
							<th style="text-align: center;">시작횟수</th>
						</tr>
					</thead>
					<tbody id="loggingData">
						<c:forEach items="${logData}" var="log" varStatus="logStat">
							<tr>
								<td style="text-align: center;">${fn:length(logData)-logStat.index}</td>
								<td style="text-align: center;">${log.osGubun}</td>
								<td style="text-align: center;">${log.model}</td>
								<td style="text-align: center;">${log.cnt}</td>
							</tr>
						</c:forEach>
						<c:if test="${empty logData}">
							<tr><td colspan="4" style="text-align: center;">데이터가 없습니다.</td></tr>
						</c:if>
					</tbody>
				</table>
			</div>
<%@ include file="/WEB-INF/pages/includes/footer.jsp" %>
		</div>
	</body>
</html> 